import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/common/xindong_define.dart';
import 'package:xindong/manager/xindong_page_singleton.dart';
import 'package:xindong/routes/tab_moments/controller/xindong_dongtai_actions_ctr.dart';
import 'package:xindong/routes/tab_moments/model/xindong_dongtai_class.dart';
import 'package:xindong/widgets/xindong_avatar.dart';
import 'package:xindong/widgets/xindong_biaoqian_view.dart';

class XinDongDongTaiListViewCellHeader extends StatelessWidget {
  final XinDongDongTaiClass model;
  final Function(XinDongDongTaiClass model) onDelete;

  const XinDongDongTaiListViewCellHeader({Key? key, required this.model, required this.onDelete}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(top: kPaddingValue),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const SizedBox(width: kPaddingValue),
          XinDongAvatar(
            url: model.head_100,
            size: 50,
            onTap: () {
              XinDongPageSingleton.instance.jumpToSpace(model);
            },
          ),
          const SizedBox(width: 10),
          Expanded(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  children: [
                    Text(
                      model.getName,
                      style: TextStyle(color: model.isHuiYuan ? Colors.red : DZColors.titleColor, fontSize: 16),
                    ),
                    const SizedBox(width: 2),
                    XinDongBiaoQianList(user: model),
                  ],
                ),
                const SizedBox(height: 5),
                Text(
                  model.content,
                  style: const TextStyle(color: DZColors.contentColor, fontSize: 15),
                ),
              ],
            ),
          ),
          IconButton(
            onPressed: () => XinDongDongTaiActionsCtr.to.onTapMore(model, onDelete: onDelete),
            icon: const Icon(
              Icons.more_horiz_rounded,
              color: DZColors.placeholderColor,
            ),
          ),
        ],
      ),
    );
  }
}
